import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { WithdrawalRecordVO, WithdrawalRecordForm, WithdrawalRecordQuery } from '@/api/retail/withdrawalRecord/types';

/**
 * 查询提现记录列表
 * @param query
 * @returns {*}
 */

export const listWithdrawalRecord = (query?: WithdrawalRecordQuery): AxiosPromise<WithdrawalRecordVO[]> => {
  return request({
    url: '/retail/withdrawalRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询提现记录详细
 * @param id
 */
export const getWithdrawalRecord = (id: string | number): AxiosPromise<WithdrawalRecordVO> => {
  return request({
    url: '/retail/withdrawalRecord/' + id,
    method: 'get'
  });
};

/**
 * 新增提现记录
 * @param data
 */
export const checkWithdrawalRecord = (id: string | number | undefined, state: number|undefined, validCode: string|undefined) => {
  const data = {
    id,
    state,
    validCode
  };
  return request({
    url: '/retail/withdrawalRecord/check',
    method: 'get',
    params: data
  });
};

